home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / lispref.info-19 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  48.9 KB  |  1,118 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo-1.63
  2. from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995
  12.  
  13.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  14. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  15. Copyright (C) 1995 Amdahl Corporation.  Copyright (C) 1995 Ben Wing.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that this permission notice may be stated in a
  29. translation approved by the Foundation.
  30.  
  31.    Permission is granted to copy and distribute modified versions of
  32. this manual under the conditions for verbatim copying, provided also
  33. that the section entitled "GNU General Public License" is included
  34. exactly as in the original, and provided that the entire resulting
  35. derived work is distributed under the terms of a permission notice
  36. identical to this one.
  37.  
  38.    Permission is granted to copy and distribute translations of this
  39. manual into another language, under the above conditions for modified
  40. versions, except that the section entitled "GNU General Public License"
  41. may be included in a translation approved by the Free Software
  42. Foundation instead of in the original English.
  43.  
  44. 
  45. File: lispref.info,  Node: Hooks,  Prev: Modeline Format,  Up: Modes
  46.  
  47. Hooks
  48. =====
  49.  
  50.    A "hook" is a variable where you can store a function or functions
  51. to be called on a particular occasion by an existing program.  XEmacs
  52. provides hooks for the sake of customization.  Most often, hooks are set
  53. up in the `.emacs' file, but Lisp programs can set them also.  *Note
  54. Standard Hooks::, for a list of standard hook variables.
  55.  
  56.    Most of the hooks in XEmacs are "normal hooks".  These variables
  57. contain lists of functions to be called with no arguments.  The reason
  58. most hooks are normal hooks is so that you can use them in a uniform
  59. way.  You can usually tell when a hook is a normal hook, because its
  60. name ends in `-hook'.
  61.  
  62.    The recommended way to add a hook function to a normal hook is by
  63. calling `add-hook' (see below).  The hook functions may be any of the
  64. valid kinds of functions that `funcall' accepts (*note What Is a
  65. Function::.).  Most normal hook variables are initially void;
  66. `add-hook' knows how to deal with this.
  67.  
  68.    As for abnormal hooks, those whose names end in `-function' have a
  69. value that is a single function.  Those whose names end in `-hooks'
  70. have a value that is a list of functions.  Any hook that is abnormal is
  71. abnormal because a normal hook won't do the job; either the functions
  72. are called with arguments, or their values are meaningful.  The name
  73. shows you that the hook is abnormal and that you should look at its
  74. documentation string to see how to use it properly.
  75.  
  76.    Major mode functions are supposed to run a hook called the "mode
  77. hook" as the last step of initialization.  This makes it easy for a user
  78. to customize the behavior of the mode, by overriding the local variable
  79. assignments already made by the mode.  But hooks are used in other
  80. contexts too.  For example, the hook `suspend-hook' runs just before
  81. XEmacs suspends itself (*note Suspending XEmacs::.).
  82.  
  83.    Here's an expression that uses a mode hook to turn on Auto Fill mode
  84. when in Lisp Interaction mode:
  85.  
  86.      (add-hook 'lisp-interaction-mode-hook 'turn-on-auto-fill)
  87.  
  88.    The next example shows how to use a hook to customize the way XEmacs
  89. formats C code.  (People often have strong personal preferences for one
  90. format or another.)  Here the hook function is an anonymous lambda
  91. expression.
  92.  
  93.      (add-hook 'c-mode-hook
  94.        (function (lambda ()
  95.                    (setq c-indent-level 4
  96.                          c-argdecl-indent 0
  97.                          c-label-offset -4
  98.                          c-continued-statement-indent 0
  99.                          c-brace-offset 0
  100.                          comment-column 40))))
  101.      
  102.      (setq c++-mode-hook c-mode-hook)
  103.  
  104.    At the appropriate time, XEmacs uses the `run-hooks' function to run
  105. particular hooks.  This function calls the hook functions that have
  106. been added with `add-hook'.
  107.  
  108.      (add-hook 'text-mode-hook
  109.        (function (lambda ()
  110.                    (setq modeline-format
  111.                          '(modeline-modified
  112.                            "Emacs: %14b"
  113.                            "  "
  114.                            default-directory
  115.                            " "
  116.                            global-mode-string
  117.                            "%[("
  118.                            mode-name
  119.                            minor-mode-alist
  120.                            "%n"
  121.                            modeline-process
  122.                            ") %]---"
  123.                            (-3 . "%p")
  124.                            "-%-")))))
  125.  
  126.    At the appropriate time, XEmacs uses the `run-hooks' function to run
  127. particular hooks.  This function calls the hook functions you have
  128. added with `add-hooks'.
  129.  
  130.  - Function: run-hooks &rest HOOKVAR
  131.      This function takes one or more hook variable names as arguments,
  132.      and runs each hook in turn.  Each HOOKVAR argument should be a
  133.      symbol that is a hook variable.  These arguments are processed in
  134.      the order specified.
  135.  
  136.      If a hook variable has a non-`nil' value, that value may be a
  137.      function or a list of functions.  If the value is a function
  138.      (either a lambda expression or a symbol with a function
  139.      definition), it is called.  If it is a list, the elements are
  140.      called, in order.  The hook functions are called with no arguments.
  141.  
  142.      For example, here's how `emacs-lisp-mode' runs its mode hook:
  143.  
  144.           (run-hooks 'emacs-lisp-mode-hook)
  145.  
  146.  - Function: add-hook HOOK FUNCTION &optional APPEND LOCAL
  147.      This function is the handy way to add function FUNCTION to hook
  148.      variable HOOK.  The argument FUNCTION may be any valid Lisp
  149.      function with the proper number of arguments.  For example,
  150.  
  151.           (add-hook 'text-mode-hook 'my-text-hook-function)
  152.  
  153.      adds `my-text-hook-function' to the hook called `text-mode-hook'.
  154.  
  155.      You can use `add-hook' for abnormal hooks as well as for normal
  156.      hooks.
  157.  
  158.      It is best to design your hook functions so that the order in
  159.      which they are executed does not matter.  Any dependence on the
  160.      order is "asking for trouble."  However, the order is predictable:
  161.      normally, FUNCTION goes at the front of the hook list, so it will
  162.      be executed first (barring another `add-hook' call).
  163.  
  164.      If the optional argument APPEND is non-`nil', the new hook
  165.      function goes at the end of the hook list and will be executed
  166.      last.
  167.  
  168.      If LOCAL is non-`nil', that says to make the new hook function
  169.      local to the current buffer.  Before you can do this, you must
  170.      make the hook itself buffer-local by calling `make-local-hook'
  171.      (*not* `make-local-variable').  If the hook itself is not
  172.      buffer-local, then the value of LOCAL makes no difference--the
  173.      hook function is always global.
  174.  
  175.  - Function: remove-hook HOOK FUNCTION &optional LOCAL
  176.      This function removes FUNCTION from the hook variable HOOK.
  177.  
  178.      If LOCAL is non-`nil', that says to remove FUNCTION from the local
  179.      hook list instead of from the global hook list.  If the hook
  180.      itself is not buffer-local, then the value of LOCAL makes no
  181.      difference.
  182.  
  183.  - Function: make-local-hook HOOK
  184.      This function makes the hook variable `hook' local to the current
  185.      buffer.  When a hook variable is local, it can have local and
  186.      global hook functions, and `run-hooks' runs all of them.
  187.  
  188.      This function works by making `t' an element of the buffer-local
  189.      value.  That serves as a flag to use the hook functions in the
  190.      default value of the hook variable as well as those in the local
  191.      value.  Since `run-hooks' understands this flag, `make-local-hook'
  192.      works with all normal hooks.  It works for only some non-normal
  193.      hooks--those whose callers have been updated to understand this
  194.      meaning of `t'.
  195.  
  196.      Do not use `make-local-variable' directly for hook variables; it is
  197.      not sufficient.
  198.  
  199. 
  200. File: lispref.info,  Node: Documentation,  Next: Files,  Prev: Modes,  Up: Top
  201.  
  202. Documentation
  203. *************
  204.  
  205.    XEmacs Lisp has convenient on-line help facilities, most of which
  206. derive their information from the documentation strings associated with
  207. functions and variables.  This chapter describes how to write good
  208. documentation strings for your Lisp programs, as well as how to write
  209. programs to access documentation.
  210.  
  211.    Note that the documentation strings for XEmacs are not the same thing
  212. as the XEmacs manual.  Manuals have their own source files, written in
  213. the Texinfo language; documentation strings are specified in the
  214. definitions of the functions and variables they apply to.  A collection
  215. of documentation strings is not sufficient as a manual because a good
  216. manual is not organized in that fashion; it is organized in terms of
  217. topics of discussion.
  218.  
  219. * Menu:
  220.  
  221. * Documentation Basics::      Good style for doc strings.
  222.                                 Where to put them.  How XEmacs stores them.
  223. * Accessing Documentation::   How Lisp programs can access doc strings.
  224. * Keys in Documentation::     Substituting current key bindings.
  225. * Describing Characters::     Making printable descriptions of
  226.                                 non-printing characters and key sequences.
  227. * Help Functions::            Subroutines used by XEmacs help facilities.
  228.  
  229. 
  230. File: lispref.info,  Node: Documentation Basics,  Next: Accessing Documentation,  Up: Documentation
  231.  
  232. Documentation Basics
  233. ====================
  234.  
  235.    A documentation string is written using the Lisp syntax for strings,
  236. with double-quote characters surrounding the text of the string.  This
  237. is because it really is a Lisp string object.  The string serves as
  238. documentation when it is written in the proper place in the definition
  239. of a function or variable.  In a function definition, the documentation
  240. string follows the argument list.  In a variable definition, the
  241. documentation string follows the initial value of the variable.
  242.  
  243.    When you write a documentation string, make the first line a complete
  244. sentence (or two complete sentences) since some commands, such as
  245. `apropos', show only the first line of a multi-line documentation
  246. string.  Also, you should not indent the second line of a documentation
  247. string, if you have one, because that looks odd when you use `C-h f'
  248. (`describe-function') or `C-h v' (`describe-variable').  *Note
  249. Documentation Tips::.
  250.  
  251.    Documentation strings may contain several special substrings, which
  252. stand for key bindings to be looked up in the current keymaps when the
  253. documentation is displayed.  This allows documentation strings to refer
  254. to the keys for related commands and be accurate even when a user
  255. rearranges the key bindings.  (*Note Accessing Documentation::.)
  256.  
  257.    Within the Lisp world, a documentation string accessible through the
  258. function or variable that it describes:
  259.  
  260.    * The documentation for a function is stored in the function
  261.      definition itself (*note Lambda Expressions::.).  The function
  262.      `documentation' knows how to extract it.
  263.  
  264.    * The documentation for a variable is stored in the variable's
  265.      property list under the property name `variable-documentation'.
  266.      The function `documentation-property' knows how to extract it.
  267.  
  268.    To save space, the documentation for preloaded functions and
  269. variables (including primitive functions and autoloaded functions) is
  270. stored in the file `emacs/etc/DOC-VERSION'.  The documentation for
  271. functions and variables loaded during the Emacs session from
  272. byte-compiled files is stored in those files (*note Docs and
  273. Compilation::.).
  274.  
  275.    The data structure inside Emacs has an integer offset into the file,
  276. or a list containing a string and an integer, in place of the
  277. documentation string.  The functions `documentation' and
  278. `documentation-property' use that information to read the documentation
  279. from the appropriate file; this is transparent to the user.
  280.  
  281.    For information on the uses of documentation strings, see *Note
  282. Help: (emacs)Help.
  283.  
  284.    The `emacs/lib-src' directory contains two utilities that you can
  285. use to print nice-looking hardcopy for the file
  286. `emacs/etc/DOC-VERSION'.  These are `sorted-doc.c' and `digest-doc.c'.
  287.  
  288. 
  289. File: lispref.info,  Node: Accessing Documentation,  Next: Keys in Documentation,  Prev: Documentation Basics,  Up: Documentation
  290.  
  291. Access to Documentation Strings
  292. ===============================
  293.  
  294.  - Function: documentation-property SYMBOL PROPERTY &optional VERBATIM
  295.      This function returns the documentation string that is recorded
  296.      SYMBOL's property list under property PROPERTY.  It retrieves the
  297.      text from a file if necessary, and runs `substitute-command-keys'
  298.      to substitute actual key bindings.  (This substitution is not done
  299.      if VERBATIM is non-`nil'; the VERBATIM argument exists only as of
  300.      Emacs 19.)
  301.  
  302.           (documentation-property 'command-line-processed
  303.              'variable-documentation)
  304.                => "t once command line has been processed"
  305.  
  306.           (symbol-plist 'command-line-processed)
  307.                => (variable-documentation 188902)
  308.  
  309.  - Function: documentation FUNCTION &optional VERBATIM
  310.      This function returns the documentation string of FUNCTION.  It
  311.      reads the text from a file if necessary.  Then (unless VERBATIM is
  312.      non-`nil') it calls `substitute-command-keys', to return a value
  313.      containing the actual (current) key bindings.
  314.  
  315.      The function `documentation' signals a `void-function' error if
  316.      FUNCTION has no function definition.  However, it is ok if the
  317.      function definition has no documentation string.  In that case,
  318.      `documentation' returns `nil'.
  319.  
  320.    Here is an example of using the two functions, `documentation' and
  321. `documentation-property', to display the documentation strings for
  322. several symbols in a `*Help*' buffer.
  323.  
  324.      (defun describe-symbols (pattern)
  325.        "Describe the Emacs Lisp symbols matching PATTERN.
  326.      All symbols that have PATTERN in their name are described
  327.      in the `*Help*' buffer."
  328.        (interactive "sDescribe symbols matching: ")
  329.        (let ((describe-func
  330.               (function
  331.                (lambda (s)
  332.  
  333.      ;; Print description of symbol.
  334.                  (if (fboundp s)             ; It is a function.
  335.                      (princ
  336.                       (format "%s\t%s\n%s\n\n" s
  337.                         (if (commandp s)
  338.                             (let ((keys (where-is-internal s)))
  339.                               (if keys
  340.                                   (concat
  341.                                    "Keys: "
  342.                                    (mapconcat 'key-description
  343.                                               keys " "))
  344.                                 "Keys: none"))
  345.                           "Function")
  346.  
  347.      (or (documentation s)
  348.                             "not documented"))))
  349.      
  350.                  (if (boundp s)              ; It is a variable.
  351.  
  352.      (princ
  353.                       (format "%s\t%s\n%s\n\n" s
  354.                         (if (user-variable-p s)
  355.                             "Option " "Variable")
  356.  
  357.      (or (documentation-property
  358.                               s 'variable-documentation)
  359.                             "not documented")))))))
  360.              sym-list)
  361.  
  362.      ;; Build a list of symbols that match pattern.
  363.          (mapatoms (function
  364.                     (lambda (sym)
  365.                       (if (string-match pattern (symbol-name sym))
  366.                           (setq sym-list (cons sym sym-list))))))
  367.  
  368.      ;; Display the data.
  369.          (with-output-to-temp-buffer "*Help*"
  370.            (mapcar describe-func (sort sym-list 'string<))
  371.            (print-help-return-message))))
  372.  
  373.    The `describe-symbols' function works like `apropos', but provides
  374. more information.
  375.  
  376.      (describe-symbols "goal")
  377.      
  378.      ---------- Buffer: *Help* ----------
  379.      goal-column     Option
  380.      *Semipermanent goal column for vertical motion, as set by C-x C-n, or nil.
  381.  
  382.      set-goal-column Command: C-x C-n
  383.      Set the current horizontal position as a goal for C-n and C-p.
  384.  
  385.      Those commands will move to this position in the line moved to
  386.      rather than trying to keep the same horizontal position.
  387.      With a non-nil argument, clears out the goal column
  388.      so that C-n and C-p resume vertical motion.
  389.      The goal column is stored in the variable `goal-column'.
  390.  
  391.      temporary-goal-column   Variable
  392.      Current goal column for vertical motion.
  393.      It is the column where point was
  394.      at the start of current run of vertical motion commands.
  395.      When the `track-eol' feature is doing its job, the value is 9999.
  396.      ---------- Buffer: *Help* ----------
  397.  
  398.  - Function: Snarf-documentation FILENAME
  399.      This function is used only during XEmacs initialization, just
  400.      before the runnable XEmacs is dumped.  It finds the file offsets
  401.      of the documentation strings stored in the file FILENAME, and
  402.      records them in the in-core function definitions and variable
  403.      property lists in place of the actual strings.  *Note Building
  404.      XEmacs::.
  405.  
  406.      XEmacs finds the file FILENAME in the `emacs/etc' directory.  When
  407.      the dumped Emacs is later executed, the same file is found in the
  408.      directory `doc-directory'.  Usually FILENAME is `"DOC-VERSION"'.
  409.  
  410.  - Variable: doc-directory
  411.      This variable holds the name of the directory which should contion
  412.      the file `"DOC-VERSION"' that contains documentation strings for
  413.      built-in and preloaded functions and variables.
  414.  
  415.      In most cases, this is the same as `data-directory'.  They may be
  416.      different when you run XEmacs from the directory where you built
  417.      it, without actually installing it.  See `data-directory' in *Note
  418.      Help Functions::.
  419.  
  420.      In older Emacs versions, `exec-directory' was used for this.
  421.  
  422. 
  423. File: lispref.info,  Node: Keys in Documentation,  Next: Describing Characters,  Prev: Accessing Documentation,  Up: Documentation
  424.  
  425. Substituting Key Bindings in Documentation
  426. ==========================================
  427.  
  428.    When documentation strings refer to key sequences, they should use
  429. the current, actual key bindings.  They can do so using certain special
  430. text sequences described below.  Accessing documentation strings in the
  431. usual way substitutes current key binding information for these special
  432. sequences.  This works by calling `substitute-command-keys'.  You can
  433. also call that function yourself.
  434.  
  435.    Here is a list of the special sequences and what they mean:
  436.  
  437. `\[COMMAND]'
  438.      stands for a key sequence that will invoke COMMAND, or `M-x
  439.      COMMAND' if COMMAND has no key bindings.
  440.  
  441. `\{MAPVAR}'
  442.      stands for a summary of the value of MAPVAR, which should be a
  443.      keymap.  The summary is made by `describe-bindings'.
  444.  
  445. `\<MAPVAR>'
  446.      stands for no text itself.  It is used for a side effect: it
  447.      specifies MAPVAR as the keymap for any following `\[COMMAND]'
  448.      sequences in this documentation string.
  449.  
  450.    *Please note:* Each `\' must be doubled when written in a string in
  451. Emacs Lisp.
  452.  
  453.  - Function: substitute-command-keys STRING
  454.      This function scans STRING for the above special sequences and
  455.      replaces them by what they stand for, returning the result as a
  456.      string.  This permits display of documentation that refers
  457.      accurately to the user's own customized key bindings.
  458.  
  459.    Here are examples of the special sequences:
  460.  
  461.      (substitute-command-keys
  462.         "To abort recursive edit, type: \\[abort-recursive-edit]")
  463.      => "To abort recursive edit, type: C-]"
  464.  
  465.      (substitute-command-keys
  466.         "The keys that are defined for the minibuffer here are:
  467.        \\{minibuffer-local-must-match-map}")
  468.      => "The keys that are defined for the minibuffer here are:
  469.      
  470.      ?               minibuffer-completion-help
  471.      SPC             minibuffer-complete-word
  472.      TAB             minibuffer-complete
  473.      LFD             minibuffer-complete-and-exit
  474.      RET             minibuffer-complete-and-exit
  475.      C-g             abort-recursive-edit
  476.      "
  477.      (substitute-command-keys
  478.         "To abort a recursive edit from the minibuffer, type\
  479.      \\<minibuffer-local-must-match-map>\\[abort-recursive-edit].")
  480.      => "To abort a recursive edit from the minibuffer, type C-g."
  481.  
  482. 
  483. File: lispref.info,  Node: Describing Characters,  Next: Help Functions,  Prev: Keys in Documentation,  Up: Documentation
  484.  
  485. Describing Characters for Help Messages
  486. =======================================
  487.  
  488.    These functions convert events, key sequences or characters to
  489. textual descriptions.  These descriptions are useful for including
  490. arbitrary text characters or key sequences in messages, because they
  491. convert non-printing and whitespace characters to sequences of printing
  492. characters.  The description of a non-whitespace printing character is
  493. the character itself.
  494.  
  495.  - Function: key-description SEQUENCE
  496.      This function returns a string containing the XEmacs standard
  497.      notation for the input events in SEQUENCE.  The argument SEQUENCE
  498.      may be a string, vector or list.  *Note Events::, for more
  499.      information about valid events.  See also the examples for
  500.      `single-key-description', below.
  501.  
  502.  - Function: single-key-description EVENT
  503.      This function returns a string describing EVENT in the standard
  504.      XEmacs notation for keyboard input.  A normal printing character
  505.      appears as itself, but a control character turns into a string
  506.      starting with `C-', a meta character turns into a string starting
  507.      with `M-', and space, linefeed, etc. appear as `SPC', `LFD', etc.
  508.      A function key symbol appears as itself.  An event that is a list
  509.      appears as the name of the symbol in the CAR of the list.
  510.  
  511.           (single-key-description ?\C-x)
  512.                => "C-x"
  513.  
  514.           (key-description "\C-x \M-y \n \t \r \f123")
  515.                => "C-x SPC M-y SPC LFD SPC TAB SPC RET SPC C-l 1 2 3"
  516.  
  517.           (single-key-description 'C-mouse-1)
  518.                => "C-mouse-1"
  519.  
  520.  - Function: text-char-description CHARACTER
  521.      This function returns a string describing CHARACTER in the
  522.      standard XEmacs notation for characters that appear in text--like
  523.      `single-key-description', except that control characters are
  524.      represented with a leading caret (which is how control characters
  525.      in Emacs buffers are usually displayed).
  526.  
  527.           (text-char-description ?\C-c)
  528.                => "^C"
  529.  
  530.           (text-char-description ?\M-m)
  531.                => "M-m"
  532.  
  533.           (text-char-description ?\C-\M-m)
  534.                => "M-^M"
  535.  
  536. 
  537. File: lispref.info,  Node: Help Functions,  Prev: Describing Characters,  Up: Documentation
  538.  
  539. Help Functions
  540. ==============
  541.  
  542.    XEmacs provides a variety of on-line help functions, all accessible
  543. to the user as subcommands of the prefix `C-h'.  For more information
  544. about them, see *Note Help: (emacs)Help.  Here we describe some
  545. program-level interfaces to the same information.
  546.  
  547.  - Command: apropos REGEXP &optional DO-ALL PREDICATE
  548.      This function finds all symbols whose names contain a match for the
  549.      regular expression REGEXP, and returns a list of them (*note
  550.      Regular Expressions::.).  It also displays the symbols in a buffer
  551.      named `*Help*', each with a one-line description.
  552.  
  553.      If DO-ALL is non-`nil', then `apropos' also shows key bindings for
  554.      the functions that are found.
  555.  
  556.      If PREDICATE is non-`nil', it should be a function to be called on
  557.      each symbol that has matched REGEXP.  Only symbols for which
  558.      PREDICATE returns a non-`nil' value are listed or displayed.
  559.  
  560.      In the first of the following examples, `apropos' finds all the
  561.      symbols with names containing `exec'.  In the second example, it
  562.      finds and returns only those symbols that are also commands.  (We
  563.      don't show the output that results in the `*Help*' buffer.)
  564.  
  565.           (apropos "exec")
  566.                => (Buffer-menu-execute command-execute exec-directory
  567.               exec-path execute-extended-command execute-kbd-macro
  568.               executing-kbd-macro executing-macro)
  569.  
  570.           (apropos "exec" nil 'commandp)
  571.                => (Buffer-menu-execute execute-extended-command)
  572.  
  573.      The command `C-h a' (`command-apropos') calls `apropos', but
  574.      specifies a PREDICATE to restrict the output to symbols that are
  575.      commands.  The call to `apropos' looks like this:
  576.  
  577.           (apropos string t 'commandp)
  578.  
  579.  - Command: super-apropos REGEXP &optional DO-ALL
  580.      This function differs from `apropos' in that it searches
  581.      documentation strings as well as symbol names for matches for
  582.      REGEXP.  By default, it searches the documentation strings only
  583.      for preloaded functions and variables.  If DO-ALL is non-`nil', it
  584.      scans the names and documentation strings of all functions and
  585.      variables.
  586.  
  587.  - Variable: help-map
  588.      The value of this variable is a local keymap for characters
  589.      following the Help key, `C-h'.
  590.  
  591.  - Prefix Command: help-command
  592.      This symbol is not a function; its function definition is actually
  593.      the keymap known as `help-map'.  It is defined in `help.el' as
  594.      follows:
  595.  
  596.           (define-key global-map "\C-h" 'help-command)
  597.           (fset 'help-command help-map)
  598.  
  599.  - Function: print-help-return-message &optional FUNCTION
  600.      This function builds a string that explains how to restore the
  601.      previous state of the windows after a help command.  After
  602.      building the message, it applies FUNCTION to it if FUNCTION is
  603.      non-`nil'.  Otherwise it calls `message' to display it in the echo
  604.      area.
  605.  
  606.      This function expects to be called inside a
  607.      `with-output-to-temp-buffer' special form, and expects
  608.      `standard-output' to have the value bound by that special form.
  609.      For an example of its use, see the long example in *Note Accessing
  610.      Documentation::.
  611.  
  612.  - Variable: help-char
  613.      The value of this variable is the help character--the character
  614.      that XEmacs recognizes as meaning Help.  By default, it is 8,
  615.      which is `C-h'.  When Emacs reads this character, if `help-form' is
  616.      non-`nil' Lisp expression, it evaluates that expression, and
  617.      displays the result in a window if it is a string.
  618.  
  619.      Usually the value of `help-form''s value is `nil'.  Then the help
  620.      character has no special meaning at the level of command input, and
  621.      it becomes part of a key sequence in the normal way.  The standard
  622.      key binding of `C-h' is a prefix key for several general-purpose
  623.      help features.
  624.  
  625.      The help character is special after prefix keys, too.  If it has no
  626.      binding as a subcommand of the prefix key, it runs
  627.      `describe-prefix-bindings', which displays a list of all the
  628.      subcommands of the prefix key.
  629.  
  630.  - Variable: help-form
  631.      If this variable is non-`nil', its value is a form to evaluate
  632.      whenever the character `help-char' is read.  If evaluating the form
  633.      produces a string, that string is displayed.
  634.  
  635.      A command that calls `read-event' or `read-char' probably should
  636.      bind `help-form' to a non-`nil' expression while it does input.
  637.      (The exception is when `C-h' is meaningful input.) Evaluating this
  638.      expression should result in a string that explains what the input
  639.      is for and how to enter it properly.
  640.  
  641.      Entry to the minibuffer binds this variable to the value of
  642.      `minibuffer-help-form' (*note Minibuffer Misc::.).
  643.  
  644.  - Variable: prefix-help-command
  645.      This variable holds a function to print help for a prefix
  646.      character.  The function is called when the user types a prefix
  647.      key followed by the help character, and the help character has no
  648.      binding after that prefix.  The variable's default value is
  649.      `describe-prefix-bindings'.
  650.  
  651.  - Function: describe-prefix-bindings
  652.      This function calls `describe-bindings' to display a list of all
  653.      the subcommands of the prefix key of the most recent key sequence.
  654.      The prefix described consists of all but the last event of that
  655.      key sequence.  (The last event is, presumably, the help character.)
  656.  
  657.    The following two functions are found in the library `helper'.  They
  658. are for modes that want to provide help without relinquishing control,
  659. such as the "electric" modes.  You must load that library with
  660. `(require 'helper)' in order to use them.  Their names begin with
  661. `Helper' to distinguish them from the ordinary help functions.
  662.  
  663.  - Command: Helper-describe-bindings
  664.      This command pops up a window displaying a help buffer containing a
  665.      listing of all of the key bindings from both the local and global
  666.      keymaps.  It works by calling `describe-bindings'.
  667.  
  668.  - Command: Helper-help
  669.      This command provides help for the current mode.  It prompts the
  670.      user in the minibuffer with the message `Help (Type ? for further
  671.      options)', and then provides assistance in finding out what the key
  672.      bindings are, and what the mode is intended for.  It returns `nil'.
  673.  
  674.      This can be customized by changing the map `Helper-help-map'.
  675.  
  676.  - Variable: data-directory
  677.      This variable holds the name of the directory in which Emacs finds
  678.      certain documentation and text files that come with Emacs.  In
  679.      older Emacs versions, `exec-directory' was used for this.
  680.  
  681.  - Macro: make-help-screen FNAME HELP-LINE HELP-TEXT HELP-MAP
  682.      This macro defines a help command named FNAME that acts like a
  683.      prefix key that shows a list of the subcommands it offers.
  684.  
  685.      When invoked, FNAME displays HELP-TEXT in a window, then reads and
  686.      executes a key sequence according to HELP-MAP.  The string
  687.      HELP-TEXT should describe the bindings available in HELP-MAP.
  688.  
  689.      The command FNAME is defined to handle a few events itself, by
  690.      scrolling the display of HELP-TEXT.  When FNAME reads one of those
  691.      special events, it does the scrolling and then reads another
  692.      event.  When it reads an event that is not one of those few, and
  693.      which has a binding in HELP-MAP, it executes that key's binding and
  694.      then returns.
  695.  
  696.      The argument HELP-LINE should be a single-line summary of the
  697.      alternatives in HELP-MAP.  In the current version of Emacs, this
  698.      argument is used only if you set the option `three-step-help' to
  699.      `t'.
  700.  
  701.  - User Option: three-step-help
  702.      If this variable is non-`nil', commands defined with
  703.      `make-help-screen' display their HELP-LINE strings in the echo
  704.      area at first, and display the longer HELP-TEXT strings only if
  705.      the user types the help character again.
  706.  
  707. 
  708. File: lispref.info,  Node: Files,  Next: Backups and Auto-Saving,  Prev: Documentation,  Up: Top
  709.  
  710. Files
  711. *****
  712.  
  713.    In XEmacs, you can find, create, view, save, and otherwise work with
  714. files and file directories.  This chapter describes most of the
  715. file-related functions of Emacs Lisp, but a few others are described in
  716. *Note Buffers::, and those related to backups and auto-saving are
  717. described in *Note Backups and Auto-Saving::.
  718.  
  719.    Many of the file functions take one or more arguments that are file
  720. names.  A file name is actually a string.  Most of these functions
  721. expand file name arguments using `expand-file-name', so that `~' is
  722. handled correctly, as are relative file names (including `../').  These
  723. functions don't recognize environment variable substitutions such as
  724. `$HOME'.  *Note File Name Expansion::.
  725.  
  726. * Menu:
  727.  
  728. * Visiting Files::           Reading files into Emacs buffers for editing.
  729. * Saving Buffers::           Writing changed buffers back into files.
  730. * Reading from Files::       Reading files into buffers without visiting.
  731. * Writing to Files::         Writing new files from parts of buffers.
  732. * File Locks::               Locking and unlocking files, to prevent
  733.                                simultaneous editing by two people.
  734. * Information about Files::  Testing existence, accessibility, size of files.
  735. * Changing File Attributes:: Renaming files, changing protection, etc.
  736. * File Names::               Decomposing and expanding file names.
  737. * Contents of Directories::  Getting a list of the files in a directory.
  738. * Create/Delete Dirs::         Creating and Deleting Directories.
  739. * Magic File Names::         Defining "magic" special handling
  740.                    for certain file names.
  741. * Partial Files::            Treating a section of a buffer as a file.
  742. * Format Conversion::        Conversion to and from various file formats.
  743. * Files and MS-DOS::         Distinguishing text and binary files on MS-DOS.
  744.  
  745. 
  746. File: lispref.info,  Node: Visiting Files,  Next: Saving Buffers,  Up: Files
  747.  
  748. Visiting Files
  749. ==============
  750.  
  751.    Visiting a file means reading a file into a buffer.  Once this is
  752. done, we say that the buffer is "visiting" that file, and call the file
  753. "the visited file" of the buffer.
  754.  
  755.    A file and a buffer are two different things.  A file is information
  756. recorded permanently in the computer (unless you delete it).  A buffer,
  757. on the other hand, is information inside of XEmacs that will vanish at
  758. the end of the editing session (or when you kill the buffer).  Usually,
  759. a buffer contains information that you have copied from a file; then we
  760. say the buffer is visiting that file.  The copy in the buffer is what
  761. you modify with editing commands.  Such changes to the buffer do not
  762. change the file; therefore, to make the changes permanent, you must
  763. "save" the buffer, which means copying the altered buffer contents back
  764. into the file.
  765.  
  766.    In spite of the distinction between files and buffers, people often
  767. refer to a file when they mean a buffer and vice-versa.  Indeed, we say,
  768. "I am editing a file," rather than, "I am editing a buffer that I will
  769. soon save as a file of the same name."  Humans do not usually need to
  770. make the distinction explicit.  When dealing with a computer program,
  771. however, it is good to keep the distinction in mind.
  772.  
  773. * Menu:
  774.  
  775. * Visiting Functions::         The usual interface functions for visiting.
  776. * Subroutines of Visiting::    Lower-level subroutines that they use.
  777.  
  778. 
  779. File: lispref.info,  Node: Visiting Functions,  Next: Subroutines of Visiting,  Up: Visiting Files
  780.  
  781. Functions for Visiting Files
  782. ----------------------------
  783.  
  784.    This section describes the functions normally used to visit files.
  785. For historical reasons, these functions have names starting with
  786. `find-' rather than `visit-'.  *Note Buffer File Name::, for functions
  787. and variables that access the visited file name of a buffer or that
  788. find an existing buffer by its visited file name.
  789.  
  790.    In a Lisp program, if you want to look at the contents of a file but
  791. not alter it, the fastest way is to use `insert-file-contents' in a
  792. temporary buffer.  Visiting the file is not necessary and takes longer.
  793. *Note Reading from Files::.
  794.  
  795.  - Command: find-file FILENAME
  796.      This command selects a buffer visiting the file FILENAME, using an
  797.      existing buffer if there is one, and otherwise creating a new
  798.      buffer and reading the file into it.  It also returns that buffer.
  799.  
  800.      The body of the `find-file' function is very simple and looks like
  801.      this:
  802.  
  803.           (switch-to-buffer (find-file-noselect filename))
  804.  
  805.      (See `switch-to-buffer' in *Note Displaying Buffers::.)
  806.  
  807.      When `find-file' is called interactively, it prompts for FILENAME
  808.      in the minibuffer.
  809.  
  810.  - Function: find-file-noselect FILENAME &optional NOWARN
  811.      This function is the guts of all the file-visiting functions.  It
  812.      finds or creates a buffer visiting the file FILENAME, and returns
  813.      it.  It uses an existing buffer if there is one, and otherwise
  814.      creates a new buffer and reads the file into it.  You may make the
  815.      buffer current or display it in a window if you wish, but this
  816.      function does not do so.
  817.  
  818.      When `find-file-noselect' uses an existing buffer, it first
  819.      verifies that the file has not changed since it was last visited or
  820.      saved in that buffer.  If the file has changed, then this function
  821.      asks the user whether to reread the changed file.  If the user says
  822.      `yes', any changes previously made in the buffer are lost.
  823.  
  824.      If `find-file-noselect' needs to create a buffer, and there is no
  825.      file named FILENAME, it displays the message `New file' in the
  826.      echo area, and leaves the buffer empty.
  827.  
  828.      If NO-WARN is non-`nil', various warnings that XEmacs normally
  829.      gives (e.g. if another buffer is already visiting FILENAME but
  830.      FILENAME has been removed from disk since that buffer was created)
  831.      are suppressed.
  832.  
  833.      The `find-file-noselect' function calls `after-find-file' after
  834.      reading the file (*note Subroutines of Visiting::.).  That function
  835.      sets the buffer major mode, parses local variables, warns the user
  836.      if there exists an auto-save file more recent than the file just
  837.      visited, and finishes by running the functions in
  838.      `find-file-hooks'.
  839.  
  840.      The `find-file-noselect' function returns the buffer that is
  841.      visiting the file FILENAME.
  842.  
  843.           (find-file-noselect "/etc/fstab")
  844.                => #<buffer fstab>
  845.  
  846.  - Command: find-file-other-window FILENAME
  847.      This command selects a buffer visiting the file FILENAME, but does
  848.      so in a window other than the selected window.  It may use another
  849.      existing window or split a window; see *Note Displaying Buffers::.
  850.  
  851.      When this command is called interactively, it prompts for FILENAME.
  852.  
  853.  - Command: find-file-read-only FILENAME
  854.      This command selects a buffer visiting the file FILENAME, like
  855.      `find-file', but it marks the buffer as read-only.  *Note Read
  856.      Only Buffers::, for related functions and variables.
  857.  
  858.      When this command is called interactively, it prompts for FILENAME.
  859.  
  860.  - Command: view-file FILENAME
  861.      This command visits FILENAME in View mode, and displays it in a
  862.      recursive edit, returning to the previous buffer when done.  View
  863.      mode is a mode that allows you to skim rapidly through the file
  864.      but does not let you modify it.  Entering View mode runs the
  865.      normal hook `view-mode-hook'.  *Note Hooks::.
  866.  
  867.      When `view-file' is called interactively, it prompts for FILENAME.
  868.  
  869.  - Variable: find-file-hooks
  870.      The value of this variable is a list of functions to be called
  871.      after a file is visited.  The file's local-variables specification
  872.      (if any) will have been processed before the hooks are run.  The
  873.      buffer visiting the file is current when the hook functions are
  874.      run.
  875.  
  876.      This variable works just like a normal hook, but we think that
  877.      renaming it would not be advisable.
  878.  
  879.  - Variable: find-file-not-found-hooks
  880.      The value of this variable is a list of functions to be called when
  881.      `find-file' or `find-file-noselect' is passed a nonexistent file
  882.      name.  `find-file-noselect' calls these functions as soon as it
  883.      detects a nonexistent file.  It calls them in the order of the
  884.      list, until one of them returns non-`nil'.  `buffer-file-name' is
  885.      already set up.
  886.  
  887.      This is not a normal hook because the values of the functions are
  888.      used and they may not all be called.
  889.  
  890. 
  891. File: lispref.info,  Node: Subroutines of Visiting,  Prev: Visiting Functions,  Up: Visiting Files
  892.  
  893. Subroutines of Visiting
  894. -----------------------
  895.  
  896.    The `find-file-noselect' function uses the `create-file-buffer' and
  897. `after-find-file' functions as subroutines.  Sometimes it is useful to
  898. call them directly.
  899.  
  900.  - Function: create-file-buffer FILENAME
  901.      This function creates a suitably named buffer for visiting
  902.      FILENAME, and returns it.  It uses FILENAME (sans directory) as
  903.      the name if that name is free; otherwise, it appends a string such
  904.      as `<2>' to get an unused name.  See also *Note Creating Buffers::.
  905.  
  906.      *Please note:* `create-file-buffer' does *not* associate the new
  907.      buffer with a file and does not select the buffer.  It also does
  908.      not use the default major mode.
  909.  
  910.           (create-file-buffer "foo")
  911.                => #<buffer foo>
  912.           (create-file-buffer "foo")
  913.                => #<buffer foo<2>>
  914.           (create-file-buffer "foo")
  915.                => #<buffer foo<3>>
  916.  
  917.      This function is used by `find-file-noselect'.  It uses
  918.      `generate-new-buffer' (*note Creating Buffers::.).
  919.  
  920.  - Function: after-find-file &optional ERROR WARN NOAUTO
  921.      This function sets the buffer major mode, and parses local
  922.      variables (*note Auto Major Mode::.).  It is called by
  923.      `find-file-noselect' and by the default revert function (*note
  924.      Reverting::.).
  925.  
  926.      If reading the file got an error because the file does not exist,
  927.      but its directory does exist, the caller should pass a non-`nil'
  928.      value for ERROR.  In that case, `after-find-file' issues a warning:
  929.      `(New File)'.  For more serious errors, the caller should usually
  930.      not call `after-find-file'.
  931.  
  932.      If WARN is non-`nil', then this function issues a warning if an
  933.      auto-save file exists and is more recent than the visited file.
  934.  
  935.      If NOAUTO is non-`nil', then this function does not turn on
  936.      auto-save mode; otherwise, it does.
  937.  
  938.      The last thing `after-find-file' does is call all the functions in
  939.      `find-file-hooks'.
  940.  
  941. 
  942. File: lispref.info,  Node: Saving Buffers,  Next: Reading from Files,  Prev: Visiting Files,  Up: Files
  943.  
  944. Saving Buffers
  945. ==============
  946.  
  947.    When you edit a file in XEmacs, you are actually working on a buffer
  948. that is visiting that file--that is, the contents of the file are
  949. copied into the buffer and the copy is what you edit.  Changes to the
  950. buffer do not change the file until you "save" the buffer, which means
  951. copying the contents of the buffer into the file.
  952.  
  953.  - Command: save-buffer &optional BACKUP-OPTION
  954.      This function saves the contents of the current buffer in its
  955.      visited file if the buffer has been modified since it was last
  956.      visited or saved.  Otherwise it does nothing.
  957.  
  958.      `save-buffer' is responsible for making backup files.  Normally,
  959.      BACKUP-OPTION is `nil', and `save-buffer' makes a backup file only
  960.      if this is the first save since visiting the file.  Other values
  961.      for BACKUP-OPTION request the making of backup files in other
  962.      circumstances:
  963.  
  964.         * With an argument of 4 or 64, reflecting 1 or 3 `C-u''s, the
  965.           `save-buffer' function marks this version of the file to be
  966.           backed up when the buffer is next saved.
  967.  
  968.         * With an argument of 16 or 64, reflecting 2 or 3 `C-u''s, the
  969.           `save-buffer' function unconditionally backs up the previous
  970.           version of the file before saving it.
  971.  
  972.  - Command: save-some-buffers &optional SAVE-SILENTLY-P EXITING
  973.      This command saves some modified file-visiting buffers.  Normally
  974.      it asks the user about each buffer.  But if SAVE-SILENTLY-P is
  975.      non-`nil', it saves all the file-visiting buffers without querying
  976.      the user.
  977.  
  978.      The optional EXITING argument, if non-`nil', requests this
  979.      function to offer also to save certain other buffers that are not
  980.      visiting files.  These are buffers that have a non-`nil' local
  981.      value of `buffer-offer-save'.  (A user who says yes to saving one
  982.      of these is asked to specify a file name to use.)  The
  983.      `save-buffers-kill-emacs' function passes a non-`nil' value for
  984.      this argument.
  985.  
  986.  - Variable: buffer-offer-save
  987.      When this variable is non-`nil' in a buffer, XEmacs offers to save
  988.      the buffer on exit even if the buffer is not visiting a file.  The
  989.      variable is automatically local in all buffers.  Normally, Mail
  990.      mode (used for editing outgoing mail) sets this to `t'.
  991.  
  992.  - Command: write-file FILENAME
  993.      This function writes the current buffer into file FILENAME, makes
  994.      the buffer visit that file, and marks it not modified.  Then it
  995.      renames the buffer based on FILENAME, appending a string like `<2>'
  996.      if necessary to make a unique buffer name.  It does most of this
  997.      work by calling `set-visited-file-name' and `save-buffer'.
  998.  
  999.  - Variable: write-file-hooks
  1000.      The value of this variable is a list of functions to be called
  1001.      before writing out a buffer to its visited file.  If one of them
  1002.      returns non-`nil', the file is considered already written and the
  1003.      rest of the functions are not called, nor is the usual code for
  1004.      writing the file executed.
  1005.  
  1006.      If a function in `write-file-hooks' returns non-`nil', it is
  1007.      responsible for making a backup file (if that is appropriate).  To
  1008.      do so, execute the following code:
  1009.  
  1010.           (or buffer-backed-up (backup-buffer))
  1011.  
  1012.      You might wish to save the file modes value returned by
  1013.      `backup-buffer' and use that to set the mode bits of the file that
  1014.      you write.  This is what `save-buffer' normally does.
  1015.  
  1016.      Even though this is not a normal hook, you can use `add-hook' and
  1017.      `remove-hook' to manipulate the list.  *Note Hooks::.
  1018.  
  1019.  - Variable: local-write-file-hooks
  1020.      This works just like `write-file-hooks', but it is intended to be
  1021.      made local to particular buffers.  It's not a good idea to make
  1022.      `write-file-hooks' local to a buffer--use this variable instead.
  1023.  
  1024.      The variable is marked as a permanent local, so that changing the
  1025.      major mode does not alter a buffer-local value.  This is
  1026.      convenient for packages that read "file" contents in special ways,
  1027.      and set up hooks to save the data in a corresponding way.
  1028.  
  1029.  - Variable: write-contents-hooks
  1030.      This works just like `write-file-hooks', but it is intended for
  1031.      hooks that pertain to the contents of the file, as opposed to
  1032.      hooks that pertain to where the file came from.  Such hooks are
  1033.      usually set up by major modes, as buffer-local bindings for this
  1034.      variable.  Switching to a new major mode always resets this
  1035.      variable.
  1036.  
  1037.  - Variable: after-save-hook
  1038.      This normal hook runs after a buffer has been saved in its visited
  1039.      file.
  1040.  
  1041.  - Variable: file-precious-flag
  1042.      If this variable is non-`nil', then `save-buffer' protects against
  1043.      I/O errors while saving by writing the new file to a temporary
  1044.      name instead of the name it is supposed to have, and then renaming
  1045.      it to the intended name after it is clear there are no errors.
  1046.      This procedure prevents problems such as a lack of disk space from
  1047.      resulting in an invalid file.
  1048.  
  1049.      As a side effect, backups are necessarily made by copying.  *Note
  1050.      Rename or Copy::.  Yet, at the same time, saving a precious file
  1051.      always breaks all hard links between the file you save and other
  1052.      file names.
  1053.  
  1054.      Some modes set this variable non-`nil' locally in particular
  1055.      buffers.
  1056.  
  1057.  - User Option: require-final-newline
  1058.      This variable determines whether files may be written out that do
  1059.      *not* end with a newline.  If the value of the variable is `t',
  1060.      then `save-buffer' silently adds a newline at the end of the file
  1061.      whenever the buffer being saved does not already end in one.  If
  1062.      the value of the variable is non-`nil', but not `t', then
  1063.      `save-buffer' asks the user whether to add a newline each time the
  1064.      case arises.
  1065.  
  1066.      If the value of the variable is `nil', then `save-buffer' doesn't
  1067.      add newlines at all.  `nil' is the default value, but a few major
  1068.      modes set it to `t' in particular buffers.
  1069.  
  1070. 
  1071. File: lispref.info,  Node: Reading from Files,  Next: Writing to Files,  Prev: Saving Buffers,  Up: Files
  1072.  
  1073. Reading from Files
  1074. ==================
  1075.  
  1076.    You can copy a file from the disk and insert it into a buffer using
  1077. the `insert-file-contents' function.  Don't use the user-level command
  1078. `insert-file' in a Lisp program, as that sets the mark.
  1079.  
  1080.  - Function: insert-file-contents FILENAME &optional VISIT BEG END
  1081.           REPLACE
  1082.      This function inserts the contents of file FILENAME into the
  1083.      current buffer after point.  It returns a list of the absolute
  1084.      file name and the length of the data inserted.  An error is
  1085.      signaled if FILENAME is not the name of a file that can be read.
  1086.  
  1087.      The function `insert-file-contents' checks the file contents
  1088.      against the defined file formats, and converts the file contents if
  1089.      appropriate.  *Note Format Conversion::.  It also calls the
  1090.      functions in the list `after-insert-file-functions'; see *Note
  1091.      Saving Properties::.
  1092.  
  1093.      If VISIT is non-`nil', this function additionally marks the buffer
  1094.      as unmodified and sets up various fields in the buffer so that it
  1095.      is visiting the file FILENAME: these include the buffer's visited
  1096.      file name and its last save file modtime.  This feature is used by
  1097.      `find-file-noselect' and you probably should not use it yourself.
  1098.  
  1099.      If BEG and END are non-`nil', they should be integers specifying
  1100.      the portion of the file to insert.  In this case, VISIT must be
  1101.      `nil'.  For example,
  1102.  
  1103.           (insert-file-contents filename nil 0 500)
  1104.  
  1105.      inserts the first 500 characters of a file.
  1106.  
  1107.      If the argument REPLACE is non-`nil', it means to replace the
  1108.      contents of the buffer (actually, just the accessible portion)
  1109.      with the contents of the file.  This is better than simply
  1110.      deleting the buffer contents and inserting the whole file, because
  1111.      (1) it preserves some marker positions and (2) it puts less data
  1112.      in the undo list.
  1113.  
  1114.    If you want to pass a file name to another process so that another
  1115. program can read the file, use the function `file-local-copy'; see
  1116. *Note Magic File Names::.
  1117.  
  1118.